index.html.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <HomePageNavigation></HomePageNavigation>
  5. <!-- 广告位 1 -->
  6. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  7. <!-- 面包屑导航 -->
  8. <div class="breadcrumb">
  9. <div class="inner">
  10. <span class="location">当前位置:</span>
  11. <el-breadcrumb :separator-icon="ArrowRight">
  12. <el-breadcrumb-item>
  13. <NuxtLink to="/">首页</NuxtLink>
  14. </el-breadcrumb-item>
  15. <el-breadcrumb-item>
  16. {{ newsDetail.con_title }}
  17. </el-breadcrumb-item>
  18. </el-breadcrumb>
  19. </div>
  20. </div>
  21. <!-- 资讯列表 -->
  22. <div class="newsDetail">
  23. <div class="inner">
  24. <div class="innerDetail">
  25. <div class="headImg"></div>
  26. <div class="innerDetail1">
  27. <div class="leftBottom" v-html="newsDetail.content"></div>
  28. </div>
  29. <div class="footImg"></div>
  30. </div>
  31. <div class="innerLeft">
  32. <ul>
  33. <li>
  34. 导航列表
  35. </li>
  36. <li v-for="(item, index) in bottomMenu" :key="index">
  37. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  38. v-if="item.id == pageId && item.id != 7" class="active">
  39. {{ item.name }}
  40. </NuxtLink>
  41. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  42. v-else-if="item.id != pageId && item.id != 7">
  43. {{ item.name }}
  44. </NuxtLink>
  45. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name"
  46. v-if="item.id == 7 && pageId == 7 && routeHref == '/specialList/7'" class="active">
  47. {{ item.name }}
  48. </NuxtLink>
  49. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name"
  50. v-else-if="item.id == 7">
  51. {{ item.name }}
  52. </NuxtLink>
  53. </li>
  54. </ul>
  55. </div>
  56. <div style="clear: both;"></div>
  57. </div>
  58. </div>
  59. <!-- 广告位 2 -->
  60. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  61. <!-- 页面底部 -->
  62. <HomeFoot1></HomeFoot1>
  63. </template>
  64. <script setup>
  65. //1.页面依赖 start ---------------------------------------->
  66. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  67. import { ArrowRight } from '@element-plus/icons-vue'
  68. import { ref, onMounted } from 'vue';
  69. //获得跳转过来的id
  70. const route = useRoute();
  71. //获得当前的完整路径
  72. const fullPath = route.path;
  73. //拆分,取出来中间这一段,然后提取数字部分
  74. const segments = fullPath.split('/');
  75. const targetSegment = segments[2];
  76. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  77. let articleId;
  78. let pageId;
  79. //通过导航路径反向查询导航id
  80. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  81. method: 'GET',
  82. query: {
  83. 'foot_pinyin': targetSegment,
  84. },
  85. });
  86. if (getRouteId.code == 200) {
  87. articleId = getRouteId.data.id;
  88. pageId = getRouteId.data.id;
  89. } else {
  90. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  91. console.log("错误位置:通过url路径查询导航池id")
  92. console.log("后端错误反馈:", getRouteId.message)
  93. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  94. }
  95. //1.页面依赖 end ---------------------------------------->
  96. //2.页面数据 start ---------------------------------------->
  97. //广告列表
  98. let adImg1 = ref([]);
  99. let adImg2 = ref([]);
  100. //获取详情
  101. const newsDetail = ref({})
  102. async function getPageData() {
  103. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  104. method: 'GET',
  105. query: {
  106. 'fcat_id': articleId,
  107. 'type': '0'
  108. },
  109. });
  110. console.log('newsDetail.value', mkdata.data);
  111. newsDetail.value = mkdata.data;
  112. console.log('newsDetail.value', newsDetail.value);
  113. }
  114. getPageData();
  115. //获得底部导航
  116. const bottomMenu = ref([]);
  117. async function getPageMenu() {
  118. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  119. method: 'GET',
  120. query: {},
  121. });
  122. bottomMenu.value = mkdata.data;
  123. }
  124. getPageMenu();
  125. //2.页面数据 end ---------------------------------------->
  126. //4.设置seo信息 start---------------------------------------->
  127. //4.1 设置seo信息
  128. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  129. method: 'GET',
  130. query: {},
  131. });
  132. let seoTitle = setData.data.website_head.title;
  133. let seoDescription = setData.data.website_head.description;
  134. let seoKeywords = setData.data.website_head.keywords;
  135. let seoSuffix = setData.data.website_head.suffix;
  136. let seoName = setData.data.website_head.website_name;
  137. useSeoMeta({
  138. title: seoTitle + "_" + seoSuffix,
  139. meta: [
  140. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  141. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  142. ]
  143. });
  144. //4.设置seo信息 end---------------------------------------->
  145. onMounted(async () => {
  146. //从客户端获取行政职能部门 加快打开速度
  147. const { $webUrl, $CwebUrl } = useNuxtApp();
  148. //广告1
  149. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0001`
  150. const responseAd1 = await fetch(url, {
  151. headers: {
  152. 'Content-Type': 'application/json',
  153. 'Userurl': $CwebUrl,
  154. 'Origin': $CwebUrl
  155. }
  156. });
  157. const resultAd1 = await responseAd1.json();
  158. adImg1.value = resultAd1.data[0];
  159. //广告2
  160. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0002`
  161. const responseAd2 = await fetch(url2, {
  162. headers: {
  163. 'Content-Type': 'application/json',
  164. 'Userurl': $CwebUrl,
  165. 'Origin': $CwebUrl
  166. }
  167. });
  168. const resultAd2 = await responseAd2.json();
  169. adImg2.value = resultAd2.data[0];
  170. })
  171. </script>
  172. <style lang="less" scoped>
  173. @import '@/assets/css/about.less';
  174. </style>